{% extends 'base.html' %}

{% block title %}执行记录{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row mb-3">
        <div class="col">
            <h2>执行记录</h2>
        </div>
    </div>
    
    <div class="row mb-3">
        <div class="col-md-6">
            <div class="input-group">
                <input type="text" id="search-input" class="form-control" placeholder="搜索记录...">
                <button class="btn btn-outline-secondary" type="button" id="search-btn">
                    <i class="bi bi-search"></i> 搜索
                </button>
            </div>
        </div>
        <div class="col-md-6 text-end">
            <div class="btn-group">
                <button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
                    <span id="filter-text">所有状态</span>
                </button>
                <ul class="dropdown-menu">
                    <li><a class="dropdown-item filter-item" href="#" data-filter="all">所有状态</a></li>
                    <li><a class="dropdown-item filter-item" href="#" data-filter="success">成功</a></li>
                    <li><a class="dropdown-item filter-item" href="#" data-filter="failed">失败</a></li>
                    <li><a class="dropdown-item filter-item" href="#" data-filter="running">运行中</a></li>
                    <li><a class="dropdown-item filter-item" href="#" data-filter="pending">等待中</a></li>
                </ul>
            </div>
        </div>
    </div>
    
    <div class="row">
        <div class="col">
            <div class="card">
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>场景</th>
                                    <th>环境</th>
                                    <th>状态</th>
                                    <th>触发方式</th>
                                    <th>开始时间</th>
                                    <th>结束时间</th>
                                    <th>耗时</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="record-list">
                                <!-- 执行记录列表将通过JavaScript动态加载 -->
                            </tbody>
                        </table>
                    </div>
                    
                    <div id="pagination" class="d-flex justify-content-between align-items-center mt-3">
                        <div>
                            <span id="pagination-info">显示 1-10 条，共 0 条</span>
                        </div>
                        <nav>
                            <ul class="pagination">
                                <!-- 分页将通过JavaScript动态加载 -->
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 查看执行记录详情模态框 -->
{% include 'record/detail_modal.html' %}

{% endblock %}

{% block scripts %}
<script src="/static/js/record_functions.js"></script>
{% endblock %}